<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>闪电批量发货 -- 大眼窝进销存系统</title>
<load href='__PUBLIC__/bootstrap/css/bootstrap.min.css' />
<load href='__PUBLIC__/Css/style.css' />
<style type="text/css">
	.order_info{height:352px;margin-left: 5px;}
	.order_info .row {min-height: 19px;line-height: 19px;}
</style>
<?php 
	function merge_order_detail(&$order_detail,$sale_detail){
        foreach ($sale_detail as $key => $value) {
            __merge_order_detail($order_detail,$sale_detail,$value,$key);
        }
        return $order_detail;
    }

    function __merge_order_detail(&$order_detail,$sale_detail,$value,$key){
       
            if($key == 0)
                $order_detail[0] = $value;
            else{
                if( !empty($value['out_number'])  
                	&& $value['out_number'] == $sale_detail[$key-1]['out_number']
                   && $value['options'] == $sale_detail[$key-1]['options'] ){
                    if(is_array($order_detail[$key-1])){
                       $order_detail[$key-1]['number'] += $value['number'];
                        $order_detail[$key-1]['total'] += $value['total']; 
                    }else{
                        __merge_order_detail($order_detail,$sale_detail,$value,$key-1);
                    }
                    
                }else
                   $order_detail[$key] = $value;
            }
        return $order_detail;
    }
 ?>
</head>
<body>
<div id="main" class="main" >
<div class="row" style="margin-left:10px;">
	<h2 class="heading">批量闪电发货</h2>
	<form method ="post"  action="__URL__/create_logino" >
		<div class="span21">
					{:modList('Logicompany',18,'span2','logicompany_id','sort desc' )}
			<font color="red"><b>默认汇通快运</b></font>，起始单号<input type="text" name="start_no" value="">
			终止单号<input type="text" name="end_no" value="">
			<input type="hidden" name="count_orders" value="{$count_orders}">
			<input type="hidden" name="oid" value="{$oid}">
			<input type="submit"  class="btn btn-primary" value="批量生成运单号">
		</div>
	</form>
</div>
<div class="row  heading" style="margin-left:10px;">
				<div class="span1">序号</div>
				<div class="span3" >订单号</div>
				<div class="span2">收货人</div>
				<div class="span4">地址</div>
				<div class="span2">快递</div>
				<div class="span3">单号</div>
				
			</div>
	<volist name="orders" id="vo">
			
			<div class="row heading" style="margin-left:10px;">
				<div class="span1">{$i}</div>
				<div class="span3" >{$vo.sale_no} <input type="hidden" name="id" value="{$vo.id}">
					<input type="hidden" name="shipping_time" value="{:time()}"> 
					<!-- TODO 暂时不改变发货状态，由客服到第三方平台填写完单号，确认发货后再来系统内改为发货状态
					<input type="hidden" name="order_status" value="3"> <!--已发货-->
					<input type="hidden" name="jumpUrl" value="__SELF__"> <!--返回发货路径-->
				</div>
				<div class="span2">{$vo.shipping_name}</div>
				<div class="span4">{$vo.address}</div>
				<!--默认天天快递 改为默认中通 2013-0701 改为圆通20130919 20131108汇通快运-->
				<div class="span2"	>
					{:modList('Logicompany',18,'span2','logicompany_id','sort desc' )}
					<!--
					<empty name="vo.logicompany_id"> 
						
						<else/>
						{:modList('Logicompany',$vo['logicompany_id'],'span2','logicompany_id','sort desc' )}
					 </empty> -->
					</div>
				<div class="span3"> <input type="text" name="logino" value="{$vo.logino}"> </div>
			</div>
	</volist>
	

</div>
</body>
</html>
